import 'package:ebuy/dio/dio_helper/dio_helper.dart';
import 'package:dio/dio.dart';

class Api {
  /// 公共上传接口
  static Future indexUpload(String filePath) async {
    return await DioHelper().request(
      '/api/index/upload',
      queryParams: FormData.fromMap({
        "file": MultipartFile.fromFileSync(filePath)
      }),
      method: RequestType.POST,
    );
  }

  /// 2出口业务接入
  static Future applyService(Map applyServiceData) async {
    return await DioHelper().request(
      '/api/access_service/apply_service',
      queryParams: {
        "data": applyServiceData,
      },
      method: RequestType.POST,
    );
  }

  /// 3出口业务查询接口
  static Future getApplyService(String businssNo) async {
    return await DioHelper().request(
      '/api/access_service/get_apply_service',
      queryParams: {
        "data": {
          "o_business_no": businssNo
        }
      },
      method: RequestType.POST,
    );
  }

  /// 4单证传输
  static Future saveApplyService(String businssNo) async {
    return await DioHelper().request(
      '/api/access_service/save_apply_service',
      queryParams: {
        "data": {
          "type": "purchase_contract",
          "business_no": businssNo,
          "message_list": [
            {
              "url": "",
              "name": ""
            }
          ]
        }
      },
      method: RequestType.POST,
    );
  }

  /// 6出口业务轨迹查询接口
  static Future getWaybillInfo(String keyword) async {
    return await DioHelper().request(
      '/api/access_service/get_waybill_info',
      queryParams: {
        "data": {
          "keyword": keyword
        }
      },
      method: RequestType.POST,
    );
  }

  /// 7出口订单查询接口
  static Future getOrderInfo(String keyword) async {
    return await DioHelper().request(
      '/api/access_service/get_order_info',
      queryParams: {
        "data": {
          "keyword": keyword
        }
      },
      method: RequestType.POST,
    );
  }

}
